<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="net.groupme.gui.constants.VIEW_VOCABULARY"%>
<%@page import="net.groupme.controller.ExportController"%>
<%@page import="net.groupme.utils.URLResolver"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<!-- meta tags, link to css:  -->
	<%@ include file="./jsp-includes/metaheader.jsp" %>
	
	<!--  Ajax-Includes -->
    <script type='text/javascript' src='/GroupMe/dwr/interface/DWRSearchManager.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/engine.js'></script>
    <script type='text/javascript' src='/GroupMe/dwr/util.js'></script>

	<title><c:out value="${resource.name}" ></c:out>  [GroupMe!]</title>
	<script type="text/javascript" language="javascript"><!--
	//<![CDATA[//>
	
	/**
	 * Visualize a tag cloud.
	 */
	 function showTagCloud(tagCloud){
	 	$('tagcloud').innerHTML = "<p><strong>most popular tags:</strong> </p>" + tagCloud.html;
	 }
	 
		//init stuff:		
		function init() {
			  DWRUtil.useLoadingMessage();
			   DWRSearchManager.getTagCloud(null, null, false, showTagCloud);
			}
	//<!]]>
	--></script>
</head>
<body onload="init()">
	<!-- title image, logo:  -->
	<div id="header">
		<%@ include file="./jsp-includes/titleheader.jsp" %>
	</div>
	
	<!-- Menu: -->
	<div id="menu">
		<%@ include file="./jsp-includes/menu.jsp" %>
	</div>
	<!-- content and sidebar -->
	<div id="main">

		<!-- Sidebar -->
		<div id="sidebar">
		<div id="tagcloud">
			<p><strong>most popular tags:</strong> </p>
			<!-- first do caching: -->
			<c:choose>
			<c:when test="${searchManager.cachedTagCloud != null}">
				<c:out value="${searchManager.cachedTagCloud.html}" escapeXml="false"/><br/>
			</c:when>
			<c:otherwise>
				no cached tag cloud
			</c:otherwise>
			</c:choose>
			</div>
		</div>

		<!-- Content: -->
		<div id="content">
			<div id="upperRight" style="text-align:right; float:right">
				<div align="right">
					<table id="exportButtons" style="margin-top:1em; text-align:center; font-size:0.8em; color: #006699; ">
						<tr>
							<td style="vertical-align:top">
								<a href="<%= request.getContextPath() + "/api/" + VIEW_VOCABULARY.ACTION_EXPORT + "?" + ExportController.PARAMETER_RESOURCE_ID + "=" %><c:out value="${resource.id}"/><%= "&" + ExportController.PARAMETER_MODE + "=" + ExportController.PARAMETER_MODE_RESOURCES +"&" + ExportController.PARAMETER_EXPORT_FORMAT + "=rdf" %>" target="GroupMe! RDF-Export" title="Export GroupMe! Resource to RDF">
									<img src="<%= request.getContextPath() %>/images/g-48x48.gif" height="24px" width="24px" style="text-decoration:none;border:none;"/>
								</a>
							</td>
							<!--<td style="vertical-align:top">
								<a href="<%= request.getContextPath() + "/api/" + VIEW_VOCABULARY.ACTION_EXPORT + "?" + ExportController.PARAMETER_RESOURCE_ID + "=" %><c:out value="${resource.id}"/><%= "&" + ExportController.PARAMETER_MODE + "=" + ExportController.PARAMETER_MODE_RESOURCES +"&" + ExportController.PARAMETER_EXPORT_FORMAT + "=rss" %>" target="GroupMe! RSS-Export" title="Export GroupMe! Resource to RSS">
									<img src="<%= request.getContextPath() %>/images/rss-48x48.gif" height="24px" width="24px" style="text-decoration:none;border:none;"/>
								</a>
							</td>
						--></tr>
						<tr>
							<td style="vertical-align:top;">GroupMe!<br/>RDF</td>
							<!--<td style="vertical-align:top;">RSS</td>-->
						</tr>							
					</table>
				</div>
			</div>
			<h1><c:out value="${resource.name}"/></h1>
		
			
			<div>
				<c:choose>
					<c:when test="${resource.type == 'image'}">
						<img src="${resource.URL}" style="width:70%;"/><br/>
						URL: <a href="${resource.URL}" target="_blank">${resource.URL}</a>
					</c:when>
					<c:when test="${resource.type == 'audio'}">
					
					</c:when>
					<c:when test="${resource.type == 'video'}">
						<object width="430px" height="380px" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">
				        	<param name="URL" value="${resource.URL}"/>
				        	<param name="AllowChangeDisplaySize" value="true"/>
				        	<param name="ShowControls" value="1"/>
				       	  	<param name="ShowDisplay" value="1"/>
				       	  	<param name="ShowStatusBar" value="1"/>
				       	  	<param name="AutoStart" value="false"/>
				       	  	<param name="InvokeURLS" value="false"/>
				          	<embed name="WMplay" ShowStatusBar="1" width="430px" height="380px" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="${resource.URL}"  AutoStart="false"></embed>
          			  	</object> 
					</c:when>
					<c:when test="${resource.type == 'rss'}">
						URL: <a href="${resource.URL}" target="_blank">${resource.URL}</a>
					</c:when>
					<c:when test="${resource.type == 'shockwave'}">
						<object width="425px" height="350px">
							<param name="movie" value="${resource.URL}"></param>
							<param name="wmode" value="transparent"></param>
							<embed  src="${resource.URL}" type="application/x-shockwave-flash" wmode="transparent" width="425px" height="350px">
							</embed>
						</object>
					</c:when>
					<c:otherwise>
						URL: <a href="${resource.URL}" target="_blank">${resource.URL}</a>
					</c:otherwise>
				</c:choose>
			</div>
			<table>
				<tr>
					<td style="vertical-align:top; font-weight:bold;">description:</td>
					<td>
						<c:if test="${resource.description == ''}">
							<i>no description</i>
						</c:if>
						<c:out value="${resource.description}"/>
					</td>
				</tr>
				<tr>
					<td style="vertical-align:top; font-weight:bold;">Groups:</td>
					<td>
						<c:if test="${resource.groups == ''}">
							<i>no description</i>
						</c:if>
						<c:forEach items="${resource.groups}" var="group" varStatus="groupStatus">
							<c:choose>
								<c:when test="${groupStatus.first}"></c:when>
								<c:when test="${groupStatus.last}"> - </c:when>
								<c:otherwise> -	</c:otherwise>
							</c:choose>
							<!-- Tag Action Link: clicking on the Tag link causes Tag-search for resources and groups-->
							<a href="<%=  VIEW_VOCABULARY.GROUPME_BASE_URL + VIEW_VOCABULARY.PARAMETER_GROUP + "/" %><c:out value='${group.id}'/>" title="Visit the <c:out value='${group.name}'/> Group"><c:out value="${group.name}"></c:out></a>
						</c:forEach>
					</td>
				</tr>
				<tr>
					<td style="vertical-align:top; font-weight:bold;">tags:</td>
					<td>
						<c:if test="${empty resource.tags}">
							<i>no tags</i>
						</c:if>
						<c:forEach items="${resource.tags}" var="tag" varStatus="tagStatus">
							<c:choose>
								<c:when test="${tagStatus.first}"></c:when>
								<c:when test="${tagStatus.last}"> - </c:when>
								<c:otherwise> -	</c:otherwise>
							</c:choose>
							<!-- Tag Action Link: clicking on the Tag link causes Tag-search for resources and groups-->
							<a href="<c:out value="${tag.URI}"/>" title="Search for groups and resources tagged with <c:out value='${tag.keyword}'/>"><c:out value="${tag.keyword}"></c:out></a>
						</c:forEach>
						<br/>
					</td>
				</tr>
				<tr>
					<td style="vertical-align:top; font-weight:bold;">metadata:</td>
					<td>
						<c:if test="${empty resource.statements}">
							<i>no metadata</i>
						</c:if>
						<c:forEach items="${resource.statements}" var="statement">
							<b>statement:</b><br/>
							subject: <c:out value="${statement.subject.URI}"/><br/>
							property: <c:out value="${statement.property}"/><br/>
							object: <c:out value="${statement.object}"/><br/>
						</c:forEach>
					</td>
				</tr>
				<tr>
					<td style="vertical-align:top; font-weight:bold;">filetype:</td><td><c:out value="${resource.type}"/></td>
				</tr>
			</table>
		</div>
	</div>
	<div id="footer">
		<%@ include file="./jsp-includes/footer.jsp" %>
	</div>
</body>
</html>